#!/bin/bash

if [ $# -lt 1 ]; then
    echo "need more than 1 argument"
    exit 1
fi

if [ $1 == "local" ]; then
    bash init.sh 0
    bash node.sh nat 1
    bash node.sh full 0 enr
    bash specialrun.sh tx 00
    bash cluster.sh $2 $3 enr
elif [ $1 == "master" ]; then
    bash init.sh 0
    bash node.sh nat 1
    mv enr enr0
    bash node.sh nat 2 enr0
    bash node.sh full 0 enr
    bash specialrun.sh tx 00
    bash cluster.sh $2 $3 enr
    bash scp.sh genesis.json
    bash scp.sh enr0
elif [ $1 == "slave" ]; then
    bash node.sh nat 0 enr0
    bash cluster.sh $2 $3 enr
else
    echo "$1 is not supported"
    exit 0
fi

echo "ok!"
 